from django.db import models

# Create your models here.


class Host(models.Model):
    hostname = models.CharField(max_length=128,unique=True)
    key = models.TextField()
    status_choices = ((0,'Waiting Approval'),
                      (1,'Accepted'),
                      (2,'Rejected'))

    status = models.SmallIntegerField(choices=status_choices,default=0)
    os_type_choices=(
        ('redhat','Redhat6.7'),
        ('redhat', 'Redhat7.3'),
        ('centos', 'Centos6.7'),
        ('windows', 'Windows'),
    )
    os_type = models.CharField(choices=os_type_choices,max_length=64,default='redhat')
    def __str__(self):
        return self.hostname


class HostGroup(models.Model):
    name = models.CharField(max_length=64,unique=True)
    hosts = models.ManyToManyField(Host,blank=True)

    def __str__(self):
        return self.name